package operation.action;

import operation.action.Goods_Operation;
import uesr.Goods;

import java.util.LinkedList;
import java.util.Scanner;

public class AddGoods implements Goods_Operation {
    @Override
    public void work(LinkedList<Goods>  goods) {
        if (goods.size() == 100) {
            System.out.println("商品数目已达上限,无法新增商品");
            return;
        }
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入菜品的名字 示例:辣子鸡丁");
        String name = scanner.nextLine();
        System.out.println("请输入菜品的价格 示例:12.00");
        double price = scanner.nextDouble();
        System.out.println("请输入菜品供应数量 示例:100");
        int count = scanner.nextInt();
        Goods good = new Goods(name,price,count);
        goods.add(good);
        System.out.println("商品新增完毕");
        // 调用查看操作


    }
}
